// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   Secure.java

package org.quickserver.util.xmlreader;

import java.io.Serializable;

// Referenced classes of package org.quickserver.util.xmlreader:
//            SecureStore

public class Secure
    implements Serializable
{

    public Secure()
    {
        enable = false;
        load = false;
        port = -1;
        protocol = "TLS";
        clientAuthEnable = false;
        secureStore = new SecureStore();
    }

    public void setEnable(boolean enable)
    {
        this.enable = enable;
        if(enable)
            setLoad(true);
    }

    public boolean getEnable()
    {
        return enable;
    }

    public boolean isEnable()
    {
        return enable;
    }

    public void setLoad(boolean load)
    {
        this.load = load;
    }

    public boolean getLoad()
    {
        return load;
    }

    public boolean isLoad()
    {
        return load;
    }

    public void setPort(int port)
    {
        if(port >= 0)
            this.port = port;
    }

    public int getPort()
    {
        return port;
    }

    public void setProtocol(String protocol)
    {
        if(protocol != null && protocol.trim().length() != 0)
            this.protocol = protocol;
    }

    public String getProtocol()
    {
        return protocol;
    }

    public void setClientAuthEnable(boolean enable)
    {
        clientAuthEnable = enable;
    }

    public boolean getClientAuthEnable()
    {
        return clientAuthEnable;
    }

    public boolean isClientAuthEnable()
    {
        return clientAuthEnable;
    }

    public void setSecureStore(SecureStore secureStore)
    {
        if(secureStore != null)
            this.secureStore = secureStore;
    }

    public SecureStore getSecureStore()
    {
        return secureStore;
    }

    public String toXML(String pad)
    {
        if(pad == null)
            pad = "";
        StringBuilder sb = new StringBuilder();
        sb.append((new StringBuilder(String.valueOf(pad))).append("<secure>\n").toString());
        sb.append((new StringBuilder(String.valueOf(pad))).append("\t<enable>").append(getEnable()).append("</enable>\n").toString());
        sb.append((new StringBuilder(String.valueOf(pad))).append("\t<load>").append(getLoad()).append("</load>\n").toString());
        if(getPort() != -1)
            sb.append((new StringBuilder(String.valueOf(pad))).append("\t<port>").append(getPort()).append("</port>\n").toString());
        sb.append((new StringBuilder(String.valueOf(pad))).append("\t<protocol>").append(getProtocol()).append("</protocol>\n").toString());
        sb.append((new StringBuilder(String.valueOf(pad))).append("\t<client-auth-enable>").append(getClientAuthEnable()).append("</client-auth-enable>\n").toString());
        if(getSecureStore() != null)
            sb.append(getSecureStore().toXML((new StringBuilder(String.valueOf(pad))).append("\t").toString()));
        sb.append((new StringBuilder(String.valueOf(pad))).append("</secure>\n").toString());
        return sb.toString();
    }

    private boolean enable;
    private boolean load;
    private int port;
    private String protocol;
    private boolean clientAuthEnable;
    private SecureStore secureStore;
}
